package com.mlz.mlzmall.ui.activity.act.order;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RatingBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.mlz.mlzmall.R;
import com.mlz.mlzmall.bean.PostAddReview;
import com.mlz.mlzmall.bean.PostUploadImageReview;
import com.mlz.mlzmall.bean.ResponseNeedReviewGoods;
import com.mlz.mlzmall.ui.activity.act.base.BaseActivity;
import com.mlz.mlzmall.ui.activity.act.personal.NetworkRequest.ProgessTools;
import com.mlz.mlzmall.ui.utils.mlz.DialogView;
import com.mlz.mlzmall.ui.utils.mlz.URL;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Semaphore;

import me.nereo.multi_image_selector.MultiImageSelectorActivity;

import com.google.gson.Gson;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;


/**
 * Created by jack.wang on 2016/1/20.
 */
public class ReviewActivity extends BaseActivity {
    // 评论商品用的ListView
    ListView reviewGoodsListView;
    // 待评价商品的布局
    int resource;
    // 回退箭头
    RelativeLayout ll_back_MyOrder_fromReview;
    private Bitmap bitmap;
    ArrayList<String> imagesUrlArray = new ArrayList<String>();
    PostAddReview postAddReview = new PostAddReview();
    private ArrayList<String> mSelectPath = new ArrayList<>();
    // 存放base64String
//    private ArrayList<String> BaseStringArray = new ArrayList<String>();
    // 待显示的5张图片
//    ImageView camer, Image0, Image1, Image2, Image3, Image4;
    private static final int REQUEST_IMAGE = 2;
    // 评论文字
    String reviewText = null;
    // 存储图片bitmap
    ArrayList<Bitmap> bitmaps = new ArrayList<Bitmap>();
    // 订单号：
    String orderCode;
    // 评价等级
    float rateCurrent = 5;

    int onclick = 0;
    private List imagelist;
    private Map imageMap;
    String SESSIONKEY;

    ReviewGoodsAdapter adapter;
    ArrayList<ResponseNeedReviewGoods.product> data;
    // 记录
    int index;
    Intent intent;
    private int cout;
    Semaphore semaphore;
    static String editStr;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.review_goods);
        getDisplayMetrics();
        SESSIONKEY = sessionId;
        imagelist = new ArrayList();
        imageMap = new HashMap();
        semaphore = new Semaphore(1);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        // 初始化控件
        intView();
        intent = getIntent();
        // 获取待评价商品信息
        orderCode = intent.getStringExtra("orderCode").toString();
        ToReviewGoods(orderCode);
        //设置监听
        setListener();
    }

    // 初始化控件
    private void intView() {
        // 评论商品用的ListView
        reviewGoodsListView = (ListView) findViewById(R.id.reviewGoodsListView);
        // 待评价商品的布局
        resource = R.layout.review_goods_item;
        // 回退箭头
        ll_back_MyOrder_fromReview = (RelativeLayout) findViewById(R.id.ll_back_MyOrder_fromReview);

    }

    // 更新待评价商品的信息
    private void ToReviewGoods(final String orderCode) {
        final Handler handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                adapter = new ReviewGoodsAdapter(getApplicationContext(), resource, data, imagelist);
                reviewGoodsListView.setAdapter(adapter);
            }
        };
        new Thread(new Runnable() {
            @Override
            public void run() {
                // 创建一个restTemplate 对象
                RestTemplate restTemplate = new RestTemplate();
                String sessionKeyLogin = SESSIONKEY;
                HttpHeaders requestHL = new HttpHeaders();
                requestHL.set("Cookie", "JSESSIONID=" + sessionKeyLogin);
                requestHL.setContentType(new MediaType("application", "json"));
                HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHL);
                ResponseEntity<String> responseGoods = restTemplate.exchange(URL.ORDER.DETAIL+"?orderCode=" + orderCode, HttpMethod.GET, requestEntity, String.class);

                data = new ArrayList<ResponseNeedReviewGoods.product>();
                try {
                    JSONObject object = new JSONObject(responseGoods.getBody().toString());
                    JSONObject dataobj = object.optJSONObject("data");
                    JSONArray products = dataobj.optJSONArray("products");
                    Gson gson = new Gson();
                    // 取到的商品product 添加到集合中
                    for (int i = 0; i < products.length(); i++) {
                        data.add(gson.fromJson(products.get(i).toString(), ResponseNeedReviewGoods.product.class));
                    }
                    Message message = handler.obtainMessage();
                    handler.sendMessage(message);
                } catch (Exception e) {
                }

            }
        }).start();

    }

    private void setListener() {
        // 回退箭头
        ll_back_MyOrder_fromReview.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    // 64base 转换器
    public String Bitmap2StrByBase64(Bitmap bit, int Sample) {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        bit.compress(Bitmap.CompressFormat.JPEG, Sample, bos);//参数100表示不压缩
        byte[] bytes = bos.toByteArray();
        return Base64.encodeToString(bytes, Base64.DEFAULT);
    }

    private DisplayMetrics dm;
    private WindowManager WM;
    private int windowWidth;
    private int windowHeigth;

    public void getDisplayMetrics() {
        WM = (WindowManager) getSystemService(WINDOW_SERVICE);

        windowWidth = WM.getDefaultDisplay().getWidth();
        windowHeigth = WM.getDefaultDisplay().getHeight();
    }


    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data1) {
        super.onActivityResult(requestCode, resultCode, data1);
        if (requestCode == REQUEST_IMAGE) {
            if (resultCode == RESULT_OK) {
                mSelectPath = data1.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
                bitmaps.clear();
                cout = mSelectPath.size();

                for (int j = 0; j < mSelectPath.size(); j++) {
                    String p = mSelectPath.get(j);
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    BitmapFactory.decodeFile(p, options);
                    options.inJustDecodeBounds = true;
                    int outHeight = options.outHeight;
                    int outWidth = options.outWidth;
                    int samle;
                    if (outWidth > outHeight)
                        samle = outWidth / (windowWidth - 130) * 5;
                    else
                        samle = outHeight / (windowWidth - 130) * 5;

                    options.inJustDecodeBounds = false;
                    if (samle > 1)
                        options.inSampleSize = samle;
                    else
                        options.inSampleSize = 1;
                    Bitmap bm1 = BitmapFactory.decodeFile(p, options);
                    bitmaps.add(bm1);
                }

                System.out.println("fattttt==data==" + data.size());
                for (int j = 0; j < data.size(); j++) {
                    if (onclick == j) {
                        imageMap.put(onclick, bitmaps);
                    } else {
                        imageMap.put(j, null);
                    }
                }
            }
            adapter.notifyDataSetChanged();
        }
    }

    public int getBitmapSize(Bitmap bitmap) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {    //API 19
            return bitmap.getAllocationByteCount();
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {//API 12
            return bitmap.getByteCount();
        }
        return bitmap.getRowBytes() * bitmap.getHeight();                //earlier version
    }

    //上传图片到服务器,追加评论
    private void UploadImage(final int item, final String path) {

        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    semaphore.acquire();
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    options.inJustDecodeBounds = true;
                    Bitmap bm1 = BitmapFactory.decodeFile(path, options);
                    int outHeight = options.outHeight;
                    int outWidth = options.outWidth;
                    int samle = outWidth / windowWidth * 2 > outHeight / windowHeigth * 2 ? outWidth / windowWidth : outHeight / windowHeigth;

                    options.inJustDecodeBounds = false;
                    System.out.println("=====Samle====" + samle);
                    if (samle > 1) {
                        options.inSampleSize = samle;
                    } else
                        options.inSampleSize = 1;
                    Bitmap bm = BitmapFactory.decodeFile(path, options);
                    System.out.println("=====Bitmap====" + getBitmapSize(bm));
                    String base64String;
                    if (getBitmapSize(bm) > 3500000)
                        base64String = Bitmap2StrByBase64(bm, 85);
                    else if (getBitmapSize(bm) > 2800000)
                        base64String = Bitmap2StrByBase64(bm, 90);
                    else
                        base64String = Bitmap2StrByBase64(bm, 100);
                    // 创建一个restTemplate 对象
                    RestTemplate restTemplate = new RestTemplate();
                    HttpHeaders httpHeaders = new HttpHeaders();
                    String sessionKeyLogin = SESSIONKEY;
                    // 设置请求头
                    httpHeaders.set("Cookie", "JSESSIONID=" + sessionKeyLogin);
                    // 把请求头放在请求实体里
                    httpHeaders.setContentType(new MediaType("application", "json"));
                    // post 参数
                    PostUploadImageReview postUploadImageReview = new PostUploadImageReview();
                    postUploadImageReview.setData(base64String);
                    postUploadImageReview.setFileName(System.currentTimeMillis() + ".jpg");
                    HttpEntity<PostUploadImageReview> requestEntityUploadImage = new HttpEntity<PostUploadImageReview>(postUploadImageReview, httpHeaders);
                    ResponseEntity<String> responseUploadForReview = restTemplate.exchange(URL.ORDER.REVIEW.UPLOAD_IMAGE_BYSTRING, HttpMethod.POST, requestEntityUploadImage, String.class);
                    // 获取图片URL
                    JSONObject object = new JSONObject(responseUploadForReview.getBody().toString());
                    JSONObject object1 = object.optJSONObject("data");
                    String Name;
                    if (object1 != null) {
                        Name = object1.optString("name");
                        imagesUrlArray.add(Name);
                        // 添加post参数
                        postAddReview.setImages(imagesUrlArray);
                        cout--;
                        if (cout == 0) {
                            commitReview(adapter, data, item);
                        }
                    }
                    base64String = null;
                    bm = null;
                    semaphore.release();
                } catch (Exception e) {
                    e.printStackTrace();
                } catch (OutOfMemoryError o) {
                    System.out.println("=====Bitmap====!!!!!!");
                }

            }
        }).start();
    }

    // 提交评论
    private void commitReview(final BaseAdapter adapter, final List list, final int item) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    // 创建一个restTemplate 对象
                    RestTemplate restTemplate = new RestTemplate();
                    HttpHeaders httpHeaders = new HttpHeaders();
                    String sessionKeyLogin = SESSIONKEY;
                    // 设置请求头
                    httpHeaders.set("Cookie", "JSESSIONID=" + sessionKeyLogin);

                    // 图片上传成功，提交评论
                    Log.i("info", "postAddReview--->>" + postAddReview);
                    // 把请求头放在请求实体里
                    HttpEntity<PostAddReview> requestEntityForReview = new HttpEntity(postAddReview, httpHeaders);
                    ResponseEntity<String> commitReview = restTemplate.exchange(URL.ORDER.REVIEW.ADD, HttpMethod.POST, requestEntityForReview, String.class);
                    JSONObject object = new JSONObject(commitReview.getBody().toString());
                    final int status = object.optInt("status");
                    final String Message = object.optString("msg");
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            if (0 == status) {
                                list.remove(item);
                                if (list.size() == 0) {
                                    setResult(200);
                                    ProgessTools.closeProgressDialog();
                                    finish();
                                }
                                ProgessTools.closeProgressDialog();
                                imageMap.put(onclick, null);
                                adapter.notifyDataSetChanged();

                            } else {
                                ProgessTools.closeProgressDialog();
                                Toast.makeText(ReviewActivity.this, Message, Toast.LENGTH_SHORT).show();
                            }
                        }
                    });
                } catch (Exception e) {
                    e.printStackTrace();
                    ProgessTools.closeProgressDialog();
                    Toast.makeText(ReviewActivity.this, "网络请求失败", Toast.LENGTH_SHORT).show();
                }

            }
        }).start();
    }

    // 弹出对话框按钮
    private void dialog(final int a) {

                    ProgessTools.showProgressDialog(ReviewActivity.this, "正在上传数据...");
                    System.out.println("fattttt====" + mSelectPath.size());
                    if (mSelectPath.size() > 0) {
                        // 上传图片到服务器
                        for (int b = 0; b < mSelectPath.size(); b++) {
                            UploadImage(a, mSelectPath.get(b));
                        }
                    } else {
                        commitReview(adapter, data, a);
                    }


    }


    // 弹出对话框按钮
    private void dialogDelete(final int j, final ImageView[] imageViews) {
        final DialogView dialogViewD = new DialogView(ReviewActivity.this,
                R.layout.dialogview_commit_pcture, R.style.pager_dialog,3,"是否确定删除图片?");
        dialogViewD.setOnBtnClickListener(new DialogView.OnBtnClickListener() {
                                              @Override
                                              public void onclick(int i) {

                                                  if (i == 2) {//删除一张图片
                                                      mSelectPath.remove(j);
                                                      bitmaps.remove(j);

                                                      imageViews[mSelectPath.size()].setImageBitmap(null);
                                                  } else if (i == 0) { // 删除全部
                                                      if (!mSelectPath.isEmpty()) {
                                                          mSelectPath.clear();
                                                          bitmaps.clear();
                                                          imageViews[0].setImageBitmap(null);
                                                          imageViews[1].setImageBitmap(null);
                                                          imageViews[2].setImageBitmap(null);
                                                          imageViews[3].setImageBitmap(null);
                                                          imageViews[4].setImageBitmap(null);
                                                      }
                                                  } else if (i == 1) {
                                                      dialogViewD.cancel();//点击取消的时候消除提示框
                                                  }
                                                  adapter.notifyDataSetChanged();
                                              }
                                          }

        );
        dialogViewD.show();
    }

    public class ReviewGoodsAdapter extends BaseAdapter {
        final private Context context;
        private int resource;
        private List imagelist;
        ImageView[] imageViews;
        private ArrayList<ResponseNeedReviewGoods.product> data;
        private DisplayImageOptions options;    // 用于下载网路图片、定义参数
        private ImageLoader imageLoader = ImageLoader.getInstance();    // 新建静态实例对象

        public ReviewGoodsAdapter(Context context, int resource, ArrayList<ResponseNeedReviewGoods.product> data, List imagelist) {
            this.context = context;
            this.resource = resource;
            this.data = data;
            this.imagelist = imagelist;
            pj = new String[data.size()];
            star = new float[data.size()];
            for(int i = 0; i<data.size(); i++){
                star[i] = 5;
            }
        }


        @Override
        public int getCount() {
            if (null == data) {
                return 0;
            } else {
                return data.size();
            }

        }

        @Override
        public Object getItem(int position) {
            return data.get(position);
        }


        @Override
        public long getItemId(int position) {
            return position;
        }

        String [] pj;
        float [] star;

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            ViewHolder vh;
            convertView = LayoutInflater.from(context).inflate(resource, null);
            vh = new ViewHolder();
            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(windowWidth / 6, windowWidth / 6);
            LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(windowWidth / 8, windowWidth / 6);
            vh.ImageGoodsForReview = (ImageView) convertView.findViewById(R.id.ImageGoodsForReview);
            vh.tv_NameForReview = (TextView) convertView.findViewById(R.id.tv_NameForReview);
            vh.tv_OrderProductId = (TextView) convertView.findViewById(R.id.tv_OrderProductId);
            vh.etInputTextForReview = (EditText) convertView.findViewById(R.id.etInputTextForReview);
            vh.camer = (ImageView) convertView.findViewById(R.id.imCameraForReview);
            vh.Image0 = (ImageView) convertView.findViewById(R.id.Image0);
            vh.Image1 = (ImageView) convertView.findViewById(R.id.Image1);
            vh.Image2 = (ImageView) convertView.findViewById(R.id.Image2);
            vh.Image3 = (ImageView) convertView.findViewById(R.id.Image3);
            vh.Image4 = (ImageView) convertView.findViewById(R.id.Image4);
            vh.camer.setLayoutParams(params2);
            vh.Image0.setLayoutParams(params);
            vh.Image1.setLayoutParams(params);
            vh.Image2.setLayoutParams(params);
            vh.Image3.setLayoutParams(params);
            vh.Image4.setLayoutParams(params);
            vh.ratingBarStyle = (RatingBar) convertView.findViewById(R.id.ratingBarStyle);
            vh.tvSurprised = (TextView) convertView.findViewById(R.id.tvSurprised);
            vh.btReviewGoods = (Button) convertView.findViewById(R.id.btReviewGoods);
            convertView.setTag(vh);
            final ImageView[] views = {vh.Image0, vh.Image1, vh.Image2, vh.Image3, vh.Image4};
            imageViews = views;
            if (null != data) {
                //显示图片
                imageLoader.displayImage(data.get(position).getImage(), vh.ImageGoodsForReview, options);
                //商品的名称
                vh.tv_NameForReview.setText(data.get(position).getName().toString());
                //OrderProductId
                vh.tv_OrderProductId.setText(String.valueOf(data.get(position).getOrderProductId()));
            }


            // 启动相机
            vh.camer.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(ReviewActivity.this, MultiImageSelectorActivity.class);
                    // 是否显示拍摄图片
                    intent.putExtra(MultiImageSelectorActivity.EXTRA_SHOW_CAMERA, true);
                    // 最大可选择图片数量
                    intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_COUNT, 5);
                    // 选择模式
                    intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_MODE, MultiImageSelectorActivity.MODE_MULTI);
                    // 默认选择
                    if (mSelectPath != null && mSelectPath.size() > 0) {
                        intent.putExtra(MultiImageSelectorActivity.EXTRA_DEFAULT_SELECTED_LIST, mSelectPath);
                    }
                    startActivityForResult(intent, REQUEST_IMAGE);
                    onclick = position;
                }

            });
            // 每张图片的监听
            if (!mSelectPath.isEmpty() && mSelectPath.size() > 0) {

                // 删除图片监听
                vh.Image0.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialogDelete(0, views);
                    }
                });
                vh.Image1.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialogDelete(1, views);
                    }
                });
                vh.Image2.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialogDelete(2, views);
                    }
                });
                vh.Image3.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialogDelete(3, views);
                    }
                });
                vh.Image4.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialogDelete(4, views);
                    }
                });
            }
            // 获得评分 与文字显示
            vh.ratingBarStyle.setRating(star[position]);
            vh.tvSurprised.setTextColor(Color.parseColor("red"));
            vh.tvSurprised.setText("惊喜");
            final TextView tvSurprised = vh.tvSurprised;
            vh.ratingBarStyle.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
                public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser)

                {
                    if (rating <= 1) {
                        rateCurrent = 1;
                    } else {
                        rateCurrent = rating;
                    }
                    switch ((int) rateCurrent) {
                        case 1:
                            star[position] = rateCurrent;
                            tvSurprised.setTextColor(Color.parseColor("gray"));
                            tvSurprised.setText("失望");
                            break;
                        case 2:
                            star[position] = rateCurrent;
                            tvSurprised.setTextColor(Color.parseColor("black"));
                            tvSurprised.setText("不满");
                            break;
                        case 3:
                            star[position] = rateCurrent;
                            tvSurprised.setTextColor(Color.parseColor("green"));
                            tvSurprised.setText("一般");
                            break;
                        case 4:
                            star[position] = rateCurrent;
                            tvSurprised.setTextColor(Color.parseColor("blue"));
                            tvSurprised.setText("满意");
                            break;
                        case 5:
                            star[position] = rateCurrent;
                            tvSurprised.setTextColor(Color.parseColor("red"));
                            tvSurprised.setText("惊喜");
                            break;
                    }
                }
            });
//            // 设置图片
            if (imageMap.size() > 0) {

                for (int b = 0; b < mSelectPath.size(); b++) {
                    if (imageMap.get(position) != null) {
                        imageViews[b].setImageBitmap((Bitmap) ((ArrayList) imageMap.get(position)).get(b));
                    }
                }
            }


            //提交评论
            final EditText etInputTextForReview = vh.etInputTextForReview;
            System.out.println("%%%%%%===##" + editStr);
            vh.etInputTextForReview.setText(pj[position]);
            vh.etInputTextForReview.addTextChangedListener(new TextWatcher() {
                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                }

                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {
                }

                @Override
                public void afterTextChanged(Editable s) {
                    pj[position] = etInputTextForReview.getText().toString();
                }
            });
            vh.btReviewGoods.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    // 没有图片
                    // 获取文本信息文本信息
                    if (!etInputTextForReview.getText().toString().isEmpty()) {
                        postAddReview.setText(etInputTextForReview.getText().toString());
                    } else {
                        final DialogView dialogView = new DialogView(ReviewActivity.this,
                                R.layout.dialogview_one, R.style.pager_dialog,1,"亲，您还没有评论，快去给好评哦！");
                        dialogView.setOnBtnClickListener(new DialogView.OnBtnClickListener() {
                            @Override
                            public void onclick(int i) {
                                dialogView.cancel();
                            }
                        });
                        dialogView.show();
                        return;
                    }
                    //添加评论的post参数
                    postAddReview.setOrderCode(orderCode);
                    postAddReview.setOrderProductId(data.get(position).orderProductId);
                    postAddReview.setTags("");
                    postAddReview.setRating((int) rateCurrent);
                    dialog(position);
                }
            });
            return convertView;
        }

        class ViewHolder {
            // 待评价商品图片
            ImageView ImageGoodsForReview;
            // 待评价商品的名称
            TextView tv_NameForReview;
            //tv_OrderProductId
            TextView tv_OrderProductId;
            // 输入文字提示
            EditText etInputTextForReview;
            // 5 张图片一个相机
            ImageView camer, Image0, Image1, Image2, Image3, Image4;
            // 获得评分
            RatingBar ratingBarStyle;
            // 显示文字
            TextView tvSurprised;
            // 提交品论按钮
            Button btReviewGoods;
            LinearLayout ll_p_show;
        }


    }
}


